﻿<?php defined('SYSPATH') or die('No direct script access.');

abstract class Controller_Base extends Controller
{
	protected $main_tpl   = 'main_tpl';
	protected $title	  = 'Audi';
	protected $categories = 'categories_tpl';
	
	protected $audi		  = null;

	public function before()
	{
		parent::before();
		$this->audi = new Model_Audi;
		
		$this->main_tpl = new View($this->main_tpl);
		$this->main_tpl->title = $this->title;
		
		$tmp_categories = $this->audi->get_categories();
		$this->categories = new View($this->categories);
		$this->categories->categories = $tmp_categories;
	}
	
	public function print_template($add_title, $content)
	{
		$this->main_tpl->title      = $add_title.$this->main_tpl->title;
		$this->main_tpl->categories = $this->categories;
		$this->main_tpl->content    = $content;
		
		$this->response->body($this->main_tpl);
	}
}